package com.kuaimacode.kframework.admin.services.account;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.kuaimacode.kframework.mybatis.mapper.user.UserAccountDetailMapper;
import com.kuaimacode.kframework.mybatis.models.user.UserAccountDetail;
import org.springframework.stereotype.Service;


/**
 * @author 12786 on 2019/5/25.
 * @version 1.0
 *
 */
@Service
public class UserAccountDetailServices extends ServiceImpl<UserAccountDetailMapper, UserAccountDetail> {

    /**
     * 根据userId查找账户明细
     * @param userId
     * @param pageNum
     * @param pageSize
     * @return
     */
    public PageInfo<UserAccountDetail> getUserAccountDetail(long userId, int pageNum, int pageSize){
        QueryWrapper<UserAccountDetail> queryWrapper = new QueryWrapper<>();
        PageHelper.startPage(pageNum,pageSize);
        queryWrapper.eq("status","0");
        queryWrapper.eq("user_id",userId);
        queryWrapper.orderByDesc("create_dt");
        return new PageInfo<>(baseMapper.selectList(queryWrapper));
    }




}
